package com.zr.domain.sp.test;

public class ExceptionDemo {
    public  void test1(int num){
        if (num==0){
            throw new NumberFormatException();
        }
    }


    public  void test2(int num) throws NumberFormatException{
        System.out.println(3/num);
    }

    public static void main(String[] args) {
        ExceptionDemo exceptionDemo = new ExceptionDemo();
        try {
//            exceptionDemo. test2(0);
            exceptionDemo.test1(0);
        }catch (Exception e){
            System.out.println(e.getMessage());
        }


    }
}
